# -*- mode: makefile-gmake; mode: flyspell-prog; -*-

# TOS-BSL arguments:
#
#   tos-bsl BSL=<bsl-port-device> BSL_PASS='-P <previous-image-file>'

PROGRAM = tos-bsl

TOS_BSL ?= tos-bsl

program: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE
	@echo "    installing $(PLATFORM) binary using tos-bsl $(BSL)"
	$(TOS_BSL) $(TOS_BSL_FLAGS) -c $(BSL) -r -e -I $(BSL_PASS) -p $(INSTALL_IHEX)
	rm -f $(subst .ihex.,.exe.,$(INSTALL_IHEX)) $(INSTALL_IHEX) 

program_no_e: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE
	@echo "    installing $(PLATFORM) binary using tos-bsl $(BSL) (without mass erase)"
	$(TOS_BSL) $(TOS_BSL_FLAGS) -c $(BSL) -r -I $(BSL_PASS) -p $(INSTALL_IHEX)
	rm -f $(subst .ihex.,.exe.,$(INSTALL_IHEX)) $(INSTALL_IHEX) 

program_bl: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE
	@echo "    installing $(PLATFORM) bootloader using tos-bsl $(BSL)"
	$(TOS_BSL) $(TOS_BSL_FLAGS) -c $(BSL) -r -e -I -p $(BOOTLOADER_IMG)

program_input: ihex
	@:

# vim: set noet ts=8 sw=8 syntax=make:
